﻿<%@ WebHandler Language="C#" Class="DealLoan" %>

using System;
using System.Web;
using System.Text;
using System.Collections.Generic;
using System.Data;
using Chenxin.Lib.Utility;
using Chenxin.Lib.Business;
using Chenxin.Lib.Business.BLL;

public class DealLoan : AjaxHandlerBase
{
    private string RecordId = string.Empty;
    //*******************************************
    //功能概要       ：基本权限初始化设定
    //参数説明       ：-
    //返回值説明     ：-
    //功能詳細       ：权限哈希表中添加操作与权限组
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-21
    //*******************************************
    public DealLoan()
    {
        //受理人输入权限
        htTypePermit.Add("inputsl", Constants.Permit_InputSL);
        //审核人输入权限
        htTypePermit.Add("inputsh", Constants.Permit_InputSH);
        //放款人输入权限
        htTypePermit.Add("inputfk", Constants.Permit_InputFK);
        //受理人修改权限
        htTypePermit.Add("updatesl", Constants.Permit_UpdateSL);
        //审核人修改权限
        htTypePermit.Add("updatesh", Constants.Permit_UpdateSH);
        //放款人修改权限
        htTypePermit.Add("updatefk", Constants.Permit_UpdateFK);
        //查看贷款详情权限
        htTypePermit.Add("viewloan", Constants.Permit_ViewAllLoan);
    }

    //*******************************************
    //功能概要       ：请求处理
    //参数説明       ：context 请求上下文
    //返回值説明     ：-
    //功能詳細       ：根据请求名 分发请求
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-21
    //*******************************************
    override public void RequestProcess(HttpContext context)
    {
        context.Response.AddHeader("pragma", "no-cache");
        context.Response.AddHeader("cache-control", "");
        context.Response.CacheControl = "no-cache";
        try
        {
            if (!string.IsNullOrEmpty(context.Request.QueryString["ModelId"]))
            {
                RecordId = context.Request.QueryString["ModelId"];
            }
            string strOp = context.Request["op"];
            string strRet = string.Empty;
            switch (strOp)
            {
                //校验成交编号
                case "chkcode":
                    strRet = ChkCode(context);
                    break;
                //获取实体
                case "getmodel":
                    strRet = GetModel(context);
                    break;
                case "getmodel1":
                    strRet = GetModel1(context);
                    break;
                case "getmodel2":
                    strRet = GetModel2(context);
                    break;
                //受理人输入相关信息
                case "inputsl":
                    strRet = addSL(context);
                    break;
                //受理人输入修改相关信息
                case "updatesl":
                    strRet = updSL(context);
                    break;
                //审核人输入相关信息
                case "inputsh":
                    strRet = addSH(context);
                    break;
                //审核人输入修改相关信息
                case "updatesh":
                    strRet = updSH(context);
                    break;
                //放款人输入相关信息
                case "inputfk":
                    strRet = addFK(context);
                    break;
                //放款人输入修改相关信息
                case "updatefk":
                    strRet = updFK(context);
                    break;
                default:
                    break;
            }
            context.Response.Write(strRet);
        }
        catch (Exception ex)
        {
            context.Response.Write(retExecResult(Constants.ExecResult.Error, ex.Message, ""));
        }
    }
    
    //*******************************************
    //功能概要       ：校验成交编号
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：校验成交编号
    //作成者         ：zou.xiaochun
    //作成日         ：2010-11-01
    //*******************************************
    private string ChkCode(HttpContext context)
    {
        try
        {
            //从请求中获得房源Code
            string Prefix = context.Request.Params["prefix"];
            string Year = context.Request.Params["year"];
            string Code = context.Request.Params["code"];
            string StrCode = Code;
            if (Code.Length < 6)
            {
                for (int i = Code.Length; i < 6; i++)
                {
                    StrCode = "0" + StrCode;
                }
            }
            string ContractCode = Prefix + "-" + Year + "-" + StrCode;
            
            //获取相应房源信息
            Chenxin.Lib.Business.BLL.ContractBaseInfo bllContractBaseInfo = new ContractBaseInfo();
            Chenxin.Lib.Business.Entity.t_Contract_BaseInfo entContractInfo = bllContractBaseInfo.GetModelByCode(ContractCode);
            //转成Json，发回客户端
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entLoan = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();
            if (entContractInfo == null)
            {
                ContractCode = "M-SH-" + Year + "-" + StrCode;
                entContractInfo = bllContractBaseInfo.GetModelByCode(ContractCode);
                if (entContractInfo == null)
                {
                    return retExecResult(Constants.ExecResult.Error, "没有相应的成交信息！", "");
                }
                else
                {
                    entLoan.Address = entContractInfo.HouseAddress;
                    entLoan.BuyerPhone = entContractInfo.BuyerPhone;
                    entLoan.SalerPhone = entContractInfo.VenderPhone;
                }
            }
            else
            {
                entLoan.Address = entContractInfo.HouseAddress;
                entLoan.BuyerPhone = entContractInfo.BuyerPhone;
                entLoan.SalerPhone = entContractInfo.VenderPhone;
            }
            
            return retExecResult(Constants.ExecResult.Succ, "获取信息成功！", entLoan);
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    //*******************************************
    //功能概要       ：保存前的成交编号自动校验
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：保存前的成交编号自动校验
    //作成者         ：zou.xiaochun
    //作成日         ：2010-11-08
    //*******************************************
    private bool CheckCode(string ContractCode)
    {
        try
        {
            //获取相应房源信息
            Chenxin.Lib.Business.BLL.ContractBaseInfo bllContractBaseInfo = new ContractBaseInfo();
            Chenxin.Lib.Business.Entity.t_Contract_BaseInfo entContractInfo = bllContractBaseInfo.GetModelByCode(ContractCode);
            //转成Json，发回客户端
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entLoan = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();
            if (entContractInfo == null)
            {
                string[] tempCode = ContractCode.Split('-');
                ContractCode = string.Empty;
                ContractCode = "M-SH-" + tempCode[2] + '-' + tempCode[3];
                entContractInfo = bllContractBaseInfo.GetModelByCode(ContractCode);
                if (entContractInfo == null)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
            else
            {
                return true;
            }
        }
        catch (Exception ex)
        {
            return false;
        }
    }

    //*******************************************
    //功能概要       ：保存前的成交编号自动校验
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：保存前的成交编号自动校验
    //作成者         ：zou.xiaochun
    //作成日         ：2010-11-08
    //*******************************************
    private Guid GetContractId(string ContractCode)
    {
        try
        {
            //获取相应房源信息
            Chenxin.Lib.Business.BLL.ContractBaseInfo bllContractBaseInfo = new ContractBaseInfo();
            Chenxin.Lib.Business.Entity.t_Contract_BaseInfo entContractInfo = bllContractBaseInfo.GetModelByCode(ContractCode);
            //转成Json，发回客户端
            if (entContractInfo == null)
            {
                string[] tempCode = ContractCode.Split('-');
                ContractCode = string.Empty;
                ContractCode = "M-SH-" + tempCode[2] + '-' + tempCode[3];
                entContractInfo = bllContractBaseInfo.GetModelByCode(ContractCode);
                if (entContractInfo != null)
                {
                    return entContractInfo.ContractId;
                }
                else
                {
                    return Guid.Empty;
                }
            }
            else
            {
                return entContractInfo.ContractId;
            }
        }
        catch (Exception ex)
        {
            return Guid.Empty;
        }
    }
    
    //*******************************************
    //功能概要       ：获取实体
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：获取实体相关信息
    //作成者         ：zou.xiaochun
    //作成日         ：2010-08-03
    //*******************************************
    private string GetModel(HttpContext context)
    {
        try
        {
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model = null;

            model = Chenxin.Lib.Business.DAL.t_Preliminary_SubInfo3.GetModel(new Guid(RecordId));
            
            if (model != null)
            {
                string[] strCode = model.ContractCode.Split('-');
                if(strCode.Length == 4)
                {
                    model.ContractCode = strCode[2] + strCode[3];
                }
                
                return retExecResult(Constants.ExecResult.Succ, "获取信息成功！", model);
            }
            else
            {
                return retExecResult(Constants.ExecResult.Succ, "数据不存在，可以输入！", "");
            }
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    //*******************************************
    //功能概要       ：获取实体
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：获取实体相关信息
    //作成者         ：zou.xiaochun
    //作成日         ：2010-08-03
    //*******************************************
    private string GetModel1(HttpContext context)
    {
        try
        {
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model = null;

            model = Chenxin.Lib.Business.DAL.t_Preliminary_SubInfo3.GetModelByRecordId(new Guid(RecordId));

            if (model != null)
            {
                string[] strCode = model.ContractCode.Split('-');
                if (strCode.Length == 4)
                {
                    model.ContractCode = strCode[2] + strCode[3];
                }

                return retExecResult(Constants.ExecResult.Succ, "获取信息成功！", model);
            }
            else
            {
                return retExecResult(Constants.ExecResult.Succ, "数据不存在，可以输入！", "");
            }
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    //*******************************************
    //功能概要       ：获取实体
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：获取实体相关信息
    //作成者         ：zou.xiaochun
    //作成日         ：2010-08-03
    //*******************************************
    private string GetModel2(HttpContext context)
    {
        try
        {
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 model = null;

            model = Chenxin.Lib.Business.DAL.t_Preliminary_SubInfo3.GetModelByRecordId(new Guid(RecordId));

            if (model != null)
            {
                return retExecResult(Constants.ExecResult.Succ, "获取信息成功！", model);
            }
            else
            {
                return retExecResult(Constants.ExecResult.Succ, "数据不存在，可以输入！", "");
            }
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }
    
    //*******************************************
    //功能概要       ：受理人输入
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：受理人输入相关信息
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-21
    //*******************************************
    private string addSL(HttpContext context)
    {
        try
        {
            //贷款处理
            string PreLoan = context.Request.Params["model"];
            string CodeYear = context.Request.Params["CodeYear"];
            string strYear = CodeYear.Substring(11, 2);

            //贷款处理业务类
            PreLoanInfo bllPreLoan = new PreLoanInfo();

            //预审信息
            //Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entPreliminary = new Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo();
            //PreliminaryBaseInfo bllPreliminary = new PreliminaryBaseInfo();

            //主贷人信息
            //Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo1 entBuyer = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo1();
            //PreBuyerInfo bllPreBuyerInfo = new PreBuyerInfo();

            //贷款处理信息
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();

            //贷款处理信息
            entPreLoan = (Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3)JsonHelp.Convert2Entity(PreLoan,
                            typeof(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3));
            //Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entOldPreLoan = bllPreLoan.GetModel(entPreLoan.MainId);

            entPreLoan = CompleteSubInfo(entPreLoan, "添加受理", strYear);
            //entPreliminary = CompletePreliminary(entPreliminary, entPreLoan);
            //entBuyer = CompleteBuyer(entBuyer, entPreLoan);
            if (entPreLoan.ContractCode == "error")
            {
                return retExecResult(Constants.ExecResult.Error, "请输入正确的成交编号！", "");
            }
            if (!string.IsNullOrEmpty(entPreLoan.ContractCode))
            {
                bool tempStatus = false;
                tempStatus = CheckCode(entPreLoan.ContractCode);
                if (!tempStatus)
                {
                    return retExecResult(Constants.ExecResult.Error, "输入的成交编号没有相关成交记录，不能受理！", "");
                }
                entPreLoan.ContractId = GetContractId(entPreLoan.ContractCode);
            }
            
            StringBuilder strWhere = new StringBuilder();
            if (entPreLoan.ContractId != Guid.Empty)
            {
                strWhere.AppendFormat(" contractid='{0}'", entPreLoan.ContractId);
                DataSet ds = Chenxin.Lib.Business.DAL.t_Preliminary_SubInfo3.GetList(strWhere.ToString());
                if (ds.Tables[0].Rows.Count > 0)
                {
                    Chenxin.Lib.Business.DAL.t_Preliminary_SubInfo3.UpdateByContractId(entPreLoan);
                }
                else
                {
                    bllPreLoan.Add(entPreLoan);
                }
            }
            else
            {
                bllPreLoan.Add(entPreLoan);
            }
            
            string text = CurrentUserInfo.UserName + "：受理人输入。房源：" + entPreLoan.Address;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_InputSL"].ToString());
            //bllPreliminary.Update(entPreliminary);
            //bllPreBuyerInfo.Update(entBuyer);
            return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_SL_LoanSucc, "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    //*******************************************
    //功能概要       ：受理人输入修改
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：受理人输入修改相关信息
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-21
    //*******************************************
    private string updSL(HttpContext context)
    {
        try
        {
            //贷款处理
            string PreLoan = context.Request.Params["model"];
            string CodeYear = context.Request.Params["CodeYear"];
            string strYear = CodeYear.Substring(11, 2);
            
            //贷款处理业务类
            PreLoanInfo bllPreLoan = new PreLoanInfo();

            //预审信息
            //Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entPreliminary = new Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo();
            //PreliminaryBaseInfo bllPreliminary = new PreliminaryBaseInfo();

            //主贷人信息
            //Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo1 entBuyer = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo1();
            //PreBuyerInfo bllPreBuyerInfo = new PreBuyerInfo();

            //贷款处理信息
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();

            //贷款处理信息
            entPreLoan = (Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3)JsonHelp.Convert2Entity(PreLoan,
                            typeof(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3));

            entPreLoan = CompleteSubInfo(entPreLoan, "修改受理", strYear);

            if (entPreLoan.ContractCode == "error")
            {
                return retExecResult(Constants.ExecResult.Error, "请输入正确的成交编号！", "");
            }
            //entPreliminary = CompletePreliminary(entPreliminary, entPreLoan);
            //entBuyer = CompleteBuyer(entBuyer, entPreLoan);
            if (!string.IsNullOrEmpty(entPreLoan.ContractCode))
            {
                bool tempStatus = false;
                tempStatus = CheckCode(entPreLoan.ContractCode);
                if (!tempStatus)
                {
                    return retExecResult(Constants.ExecResult.Error, "输入的成交编号没有相关成交记录，不能受理！", "");
                }
                entPreLoan.ContractId = GetContractId(entPreLoan.ContractCode);
            }
            
            StringBuilder strWhere = new StringBuilder();
            if (entPreLoan.ContractId != Guid.Empty)
            {
                strWhere.AppendFormat(" contractid='{0}'", entPreLoan.ContractId);
                DataSet ds = Chenxin.Lib.Business.DAL.t_Preliminary_SubInfo3.GetList(strWhere.ToString());
                if (ds.Tables[0].Rows.Count > 0)
                {
                    Chenxin.Lib.Business.DAL.t_Preliminary_SubInfo3.UpdateByContractId(entPreLoan);
                }
                else
                {
                    bllPreLoan.Update(entPreLoan);
                }
            }
            else
            {
                bllPreLoan.Update(entPreLoan);
            }
            string text = CurrentUserInfo.UserName + "：受理人修改。房源：" + entPreLoan.Address;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_InputSL"].ToString());
            //bllPreliminary.Update(entPreliminary);
            //bllPreBuyerInfo.Update(entBuyer);
            return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_SL_Upd_LoanSucc, "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    //*******************************************
    //功能概要       ：审核人输入
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：审核人输入相关信息
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-21
    //*******************************************
    private string addSH(HttpContext context)
    {
        try
        {
            //贷款处理
            string PreLoan = context.Request.Params["model"];

            //贷款处理业务类
            PreLoanInfo bllPreLoan = new PreLoanInfo();

            //贷款处理信息
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();

            //贷款处理信息
            entPreLoan = (Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3)JsonHelp.Convert2Entity(PreLoan,
                            typeof(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3));

            entPreLoan = CompleteSubInfo(entPreLoan, "添加审核","");
            bllPreLoan.Update(entPreLoan);
            string text = CurrentUserInfo.UserName + "：审核人输入。房源：" + entPreLoan.Address;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_InputSH"].ToString());
            return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_SH_LoanSucc, "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    //*******************************************
    //功能概要       ：审核人输入修改
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：审核人输入修改相关信息
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-21
    //*******************************************
    private string updSH(HttpContext context)
    {
        try
        {
            //贷款处理
            string PreLoan = context.Request.Params["model"];

            //贷款处理业务类
            PreLoanInfo bllPreLoan = new PreLoanInfo();

            //贷款处理信息
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();

            //贷款处理信息
            entPreLoan = (Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3)JsonHelp.Convert2Entity(PreLoan,
                            typeof(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3));

            entPreLoan = CompleteSubInfo(entPreLoan, "修改审核","");
            bllPreLoan.Update(entPreLoan);
            string text = CurrentUserInfo.UserName + "：审核人修改。房源：" + entPreLoan.Address;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_InputSH"].ToString());
            return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_SH_Upd_LoanSucc, "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    //*******************************************
    //功能概要       ：放款人输入
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：放款人输入相关信息
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-21
    //*******************************************
    private string addFK(HttpContext context)
    {
        try
        {
            //贷款处理
            string PreLoan = context.Request.Params["model"];

            //贷款处理业务类
            PreLoanInfo bllPreLoan = new PreLoanInfo();

            //贷款处理信息
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();

            //贷款处理信息
            entPreLoan = (Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3)JsonHelp.Convert2Entity(PreLoan,
                            typeof(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3));

            entPreLoan = CompleteSubInfo(entPreLoan, "添加放款","");
            bllPreLoan.Update(entPreLoan);
            string text = CurrentUserInfo.UserName + "：放款人输入。房源：" + entPreLoan.Address;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_InputFK"].ToString());
            return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_FK_LoanSucc, "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    //*******************************************
    //功能概要       ：放款人输入修改
    //参数説明       ：context 请求上下文
    //返回值説明     ：程序处理信息提示
    //功能詳細       ：放款人输入修改相关信息
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-21
    //*******************************************
    private string updFK(HttpContext context)
    {
        try
        {
            //贷款处理
            string PreLoan = context.Request.Params["model"];

            //贷款处理业务类
            PreLoanInfo bllPreLoan = new PreLoanInfo();

            //贷款处理信息
            Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan = new Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3();

            //贷款处理信息
            entPreLoan = (Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3)JsonHelp.Convert2Entity(PreLoan,
                            typeof(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3));

            entPreLoan = CompleteSubInfo(entPreLoan, "修改放款","");
            bllPreLoan.Update(entPreLoan);
            string text = CurrentUserInfo.UserName + "：放款人修改。房源：" + entPreLoan.Address;
            AddLog(text, BusinessType.BusinessTypeComboList()["OprType_InputFK"].ToString());
            return retExecResult(Constants.ExecResult.Succ, Resources.Message.Msg_FK_Upd_LoanSucc, "");
        }
        catch (Exception ex)
        {
            return retExecResult(Constants.ExecResult.Error, ex.Message, "");
        }
    }

    //*******************************************
    //功能概要       ：填充预审信息字段
    //参数説明       ：context 请求上下文
    //返回值説明     ：预审信息实体
    //功能詳細       ：填充预审信息字段
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-09
    //*******************************************
    private Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo CompletePreliminary(Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entPreliminary, Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan)
    {
        //预审贷款信息处理业务类
        Chenxin.Lib.Business.BLL.PreliminaryBaseInfo bllPreliminary = new Chenxin.Lib.Business.BLL.PreliminaryBaseInfo();
        Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo entOldPreliminary = bllPreliminary.GetModel(entPreLoan.MainId);

        //更新预审信息
        if (!entOldPreliminary.RecordId.Equals(Guid.Empty))
        {
            entPreliminary.RecordId = entOldPreliminary.RecordId;
            entPreliminary.HouseId = entOldPreliminary.HouseId;
            entPreliminary.HouseCode = entOldPreliminary.HouseCode;
            entPreliminary.Address = entPreLoan.Address;
            entPreliminary.BuildingArea = entPreLoan.BuildingArea;
            entPreliminary.BuildingType = entOldPreliminary.BuildingType;
            entPreliminary.SalePrice_T = entPreLoan.SalePrice_T;
            entPreliminary.Total_Floor = entPreLoan.Total_Floor;
            entPreliminary.CompleteYear = entPreLoan.CompleteYear;
            entPreliminary.SaleName = entPreLoan.SaleName;
            entPreliminary.SaleIDCard = entPreLoan.SaleName;
            entPreliminary.SaleSpouseeName = entOldPreliminary.SaleSpouseeName;
            entPreliminary.SaleSpouseeIDCard = entOldPreliminary.SaleSpouseeIDCard;
            entPreliminary.LoanInfo = entPreLoan.LoanInfo;
            entPreliminary.Remark = entPreLoan.Remark;
            entPreliminary.OldLoanBank = entPreLoan.OldLoanBank;
            entPreliminary.OldLoanMoney = entPreLoan.OldLoanMoney;
            entPreliminary.OldRestMoney = entPreLoan.OldRestMoney;
            entPreliminary.OperateQuanZ = entOldPreliminary.OperateQuanZ;
            entPreliminary.EmpCompanyId = entPreLoan.EmpCompanyId;
            entPreliminary.EmpCompanyName = entPreLoan.EmpCompanyName;
            entPreliminary.EmpDepartId = entPreLoan.EmpDepartId;
            entPreliminary.EmpDepartName = entPreLoan.EmpDepartName;
            entPreliminary.EmployeeId = entPreLoan.EmployeeId;
            entPreliminary.EmployeeName = entPreLoan.EmployeeName;
            entPreliminary.EmpPhone = entPreLoan.EmpPhone;
            entPreliminary.EstimatePrice = entPreLoan.EstimatePrice;
            entPreliminary.ProposeBank = entOldPreliminary.ProposeBank;
            entPreliminary.GJJmoney = entPreLoan.GJJmoney;
            entPreliminary.GJJyear = entPreLoan.GJJyear;
            entPreliminary.SYMoney = entPreLoan.SYMoney;
            entPreliminary.SYYear = entPreLoan.SYYear;
            entPreliminary.ReplyAdivce = entOldPreliminary.ReplyAdivce;
            entPreliminary.ReplyCompanyId = entOldPreliminary.ReplyCompanyId;
            entPreliminary.ReplyCompanyName = entOldPreliminary.ReplyCompanyName;
            entPreliminary.ReplyDepartId = entOldPreliminary.ReplyDepartId;
            entPreliminary.ReplyDepartName = entOldPreliminary.ReplyDepartName;
            entPreliminary.ReplyUserId = entOldPreliminary.ReplyUserId;
            entPreliminary.ReplyUserName = entOldPreliminary.ReplyUserName;
            entPreliminary.ReplyPreliminaryDate = entOldPreliminary.ReplyPreliminaryDate;
            entPreliminary.LoanApplyDate = entOldPreliminary.LoanApplyDate;
            entPreliminary.OrderPlace = entPreLoan.OrderPlace;
            entPreliminary.OrderBank = entPreLoan.ReceiveBank;
            entPreliminary.OrderBeiZhu = entOldPreliminary.OrderBeiZhu;
            entPreliminary.LoanReplyDate = entOldPreliminary.LoanReplyDate;
            entPreliminary.PreliminaryStatus = entOldPreliminary.PreliminaryStatus;
            entPreliminary.delName = entOldPreliminary.delName;
            entPreliminary.delUserId = entOldPreliminary.delUserId;
            entPreliminary.delTime = entOldPreliminary.delTime;
            entPreliminary.ContractId = entPreLoan.ContractId;
            entPreliminary.ContractCode = entPreLoan.ContractCode;
            entPreliminary.ContractDate = entOldPreliminary.ContractDate;
            entPreliminary.PreliminaryApplyDate = entOldPreliminary.PreliminaryApplyDate;
            entPreliminary.SpecialExp = entOldPreliminary.SpecialExp;
        }

        entPreliminary.LastDate = DateTime.Now;
        entPreliminary.OperateCompanyId = CurrentUserInfo.CompanyId;
        entPreliminary.OperateCompanyName = CurrentUserInfo.CompanyName;
        entPreliminary.OperateDepartId = CurrentUserInfo.DepartId;
        entPreliminary.OperateDepartName = CurrentUserInfo.DepartName;
        entPreliminary.OperateUserId = CurrentUserInfo.UserId;
        entPreliminary.OperateUserName = CurrentUserInfo.UserName;

        return entPreliminary;
    }

    //*******************************************
    //功能概要       ：填充预审信息字段
    //参数説明       ：context 请求上下文
    //返回值説明     ：预审信息实体
    //功能詳細       ：填充预审信息字段
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-09
    //*******************************************
    private Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo1 CompleteBuyer(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo1 entBuyer, Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan)
    {
        //预审贷款信息处理业务类
        Chenxin.Lib.Business.BLL.PreBuyerInfo bllPreBuyerInfo = new PreBuyerInfo();
        Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo1 entOldBuyer = bllPreBuyerInfo.GetMainModel(entPreLoan.MainId);

        //添加预审信息
        if (!entOldBuyer.RecordId.Equals(Guid.Empty))
        {
            entBuyer.RecordId = entOldBuyer.RecordId;
            entBuyer.MainId = entOldBuyer.MainId;
            entBuyer.CustomerName = entPreLoan.CustomerName;
            entBuyer.IDNum = entPreLoan.IDNum;
            entBuyer.GJJNum = entOldBuyer.GJJNum;
            entBuyer.SpousesName = entOldBuyer.SpousesName;
            entBuyer.SpousesIDNum = entOldBuyer.SpousesIDNum;
            entBuyer.SpousesGJJNum = entOldBuyer.SpousesGJJNum;
            entBuyer.BOwner = entOldBuyer.BOwner;
        }
        return entBuyer;
    }
    
    //*******************************************
    //功能概要       ：填充预审信息字段
    //参数説明       ：context 请求上下文
    //返回值説明     ：预审信息实体
    //功能詳細       ：填充预审信息字段
    //作成者         ：zou.xiaochun
    //作成日         ：2010-07-09
    //*******************************************
    private Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 CompleteSubInfo(Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entPreLoan, string status,string year)
    {
        //贷款处理信息处理业务类
        Chenxin.Lib.Business.BLL.PreLoanInfo bllPreLoanInfo = new Chenxin.Lib.Business.BLL.PreLoanInfo();
        Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entOldPreLoan = bllPreLoanInfo.GetLoanModel(entPreLoan.RecordId);
        Chenxin.Lib.Business.Entity.t_Preliminary_SubInfo3 entOldLoanCode = bllPreLoanInfo.GetLoanCode();
        string tempNewCode = "DK-CXSH-" + year + "-";
        DataSet tempDs = bllPreLoanInfo.GetLoanCount("LoanCode like " + "'" + tempNewCode + "%'");

        //添加受理人信息
        if (status.Equals("添加受理"))
        {
            entPreLoan.MainId = entPreLoan.MainId;
            entPreLoan.RecordId = Guid.NewGuid();
            if (entOldLoanCode.LoanCode == null)
            {
                if (tempDs == null)
                {
                    entPreLoan.LoanCode = "DK-CXSH-" + year + "-" + "1";
                }
                else if (tempDs.Tables[0].Rows[0]["count"].ToString()=="0")
                {
                    entPreLoan.LoanCode = "DK-CXSH-" + year + "-" + "1";
                }
                else
                {
                    entPreLoan.LoanCode = "DK-CXSH-" + year + "-" + tempDs.Tables[0].Rows[0]["count"].ToString();
                }
            }
            else
            {
                entPreLoan.LoanCode = entOldLoanCode.LoanCode;
            }
            //else
            //{
            //    string[] strCode = entOldLoanCode.LoanCode.Split('-');
            //    if (strCode[0].ToString().Equals("M"))
            //    {
            //        string tempCode = (int.Parse(strCode[3].ToString()) + 1).ToString();
            //        int tempLength = 6 - tempCode.Length;
            //        for (int i = 0; i < tempLength; i++)
            //        {
            //            tempCode = "0" + tempCode;
            //        }
            //        entPreLoan.LoanCode = "DK-" + tempCode;
            //    }
            //    else
            //    {
            //        string tempCode = (int.Parse(strCode[1].ToString()) + 1).ToString();
            //        int tempLength = 8 - tempCode.Length;
            //        for (int i = 0; i < tempLength; i++)
            //        {
            //            tempCode = "0" + tempCode;
            //        }
            //        entPreLoan.LoanCode = "DK-" + tempCode;
            //    }
            //}

            if (!string.IsNullOrEmpty(entPreLoan.ContractCode))
            {
                string[] tempStr = entPreLoan.ContractCode.Split('-');
                string StrCode = string.Empty;
                string StrCity = string.Empty;
                if (tempStr.Length == 1)
                {
                    string strContractCode = entPreLoan.ContractCode;
                    StrCode = strContractCode;
                    if (strContractCode.Length <= 6)
                    {
                        if (strContractCode.Length < 6)
                        {
                            for (int i = strContractCode.Length; i < 6; i++)
                            {
                                StrCode = "0" + StrCode;
                            }
                        }

                        switch (CurrentUserInfo.CompanyName)
                        {
                            case "上海臣信":
                                StrCity = "M-CXSH-";
                                break;
                            case "杭州臣信":
                                StrCity = "M-CXHZ-";
                                break;
                            case "武汉臣信":
                                StrCity = "M-CXWH-";
                                break;
                            case "昆山臣信":
                                StrCity = "M-CXKS-";
                                break;
                            case "长春臣信":
                                StrCity = "M-CXCC-";
                                break;
                            case "南京臣信":
                                StrCity = "M-CXNJ-";
                                break;
                            case "苏州臣信":
                                StrCity = "M-CXSZ-";
                                break;
                        }
                        entPreLoan.ContractCode = StrCity + year + "-" + StrCode;
                    }
                    else
                    {
                        entPreLoan.ContractCode = "error";
                    }
                }
            }
            entPreLoan.EmpCityId = CurrentUserInfo.CityId;
            entPreLoan.EmpCityName = CurrentUserInfo.CityName;
            entPreLoan.EmpCompanyId = CurrentUserInfo.CompanyId;
            entPreLoan.EmpCompanyName = CurrentUserInfo.CompanyName;
            entPreLoan.SLDate = DateTime.Now;
            entPreLoan.Status = 10;
        }
        //修改受理人信息
        else if(status.Equals("修改受理"))
        {
            if (!string.IsNullOrEmpty(entPreLoan.ContractCode))
            {
                string[] tempStr = entPreLoan.ContractCode.Split('-');
                string StrCode = string.Empty;
                string StrCity = string.Empty;
                if (tempStr.Length == 1)
                {
                    string strContractCode = entPreLoan.ContractCode;
                    StrCode = strContractCode;
                    if (strContractCode.Length <= 6)
                    {
                        if (strContractCode.Length < 6)
                        {
                            for (int i = strContractCode.Length; i < 6; i++)
                            {
                                StrCode = "0" + StrCode;
                            }
                        }

                        switch (CurrentUserInfo.CompanyName)
                        {
                            case "上海臣信":
                                StrCity = "M-CXSH-";
                                break;
                            case "杭州臣信":
                                StrCity = "M-CXHZ-";
                                break;
                            case "武汉臣信":
                                StrCity = "M-CXWH-";
                                break;
                            case "昆山臣信":
                                StrCity = "M-CXKS-";
                                break;
                            case "长春臣信":
                                StrCity = "M-CXCC-";
                                break;
                            case "南京臣信":
                                StrCity = "M-CXNJ-";
                                break;
                            case "苏州臣信":
                                StrCity = "M-CXSZ-";
                                break;
                        }
                        entPreLoan.ContractCode = StrCity + year + "-" + StrCode;
                    }
                    else
                    {
                        entPreLoan.ContractCode = "error";
                    }
                }
            }
            //else
            //{
            //    entPreLoan.ContractCode = entOldPreLoan.ContractCode;
            //}
            entPreLoan.RecordId = entOldPreLoan.RecordId;
            entPreLoan.MainId = entOldPreLoan.MainId;
            entPreLoan.LoanCode = entOldPreLoan.LoanCode;
            entPreLoan.BankQueryFee = entOldPreLoan.BankQueryFee;
            entPreLoan.BankManageFee = entOldPreLoan.BankManageFee;
            entPreLoan.Remark = entOldPreLoan.Remark;
            entPreLoan.SHRemark = entOldPreLoan.SHRemark;
            entPreLoan.FKRemark = entOldPreLoan.FKRemark;
            entPreLoan.BankLoanDate = entOldPreLoan.BankLoanDate;
            entPreLoan.ReceiveLoanDate = entOldPreLoan.ReceiveLoanDate;
            entPreLoan.SendToBankDate = entOldPreLoan.SendToBankDate;
            entPreLoan.VoucherToBankDate = entOldPreLoan.VoucherToBankDate;
            entPreLoan.CertificateDate = entOldPreLoan.CertificateDate;
            entPreLoan.BankCompleteDate = entOldPreLoan.BankCompleteDate;
            entPreLoan.EstimReportBackDate = entOldPreLoan.EstimReportBackDate;
            entPreLoan.CompleteLoanDate = entOldPreLoan.CompleteLoanDate;
            entPreLoan.SLDate = entOldPreLoan.SLDate;
            entPreLoan.SHDate = entOldPreLoan.SHDate;
            entPreLoan.FKDate = entOldPreLoan.FKDate;
            entPreLoan.UpSHDate = entOldPreLoan.UpSHDate;
            entPreLoan.UpFKDate = entOldPreLoan.UpFKDate;
            entPreLoan.EmpCityId = CurrentUserInfo.CityId;
            entPreLoan.EmpCityName = CurrentUserInfo.CityName;
            entPreLoan.EmpCompanyId = CurrentUserInfo.CompanyId;
            entPreLoan.EmpCompanyName = CurrentUserInfo.CompanyName;
            entPreLoan.UpSLDate = DateTime.Now;
            entPreLoan.Status = 20;
        }
        //添加审核人信息
        else if (status.Equals("添加审核"))
        {
            entPreLoan.RecordId = entOldPreLoan.RecordId;
            entPreLoan.MainId = entOldPreLoan.MainId;
            entPreLoan.LoanCode = entOldPreLoan.LoanCode;
            entPreLoan.LoanInfo = entOldPreLoan.LoanInfo;
            entPreLoan.LoanDealMode = entOldPreLoan.LoanDealMode;
            entPreLoan.Address = entOldPreLoan.Address;
            entPreLoan.LackInfo = entOldPreLoan.LackInfo;
            entPreLoan.EvaluateCorp = entOldPreLoan.EvaluateCorp;
            entPreLoan.EvaluateFee = entOldPreLoan.EvaluateFee;
            entPreLoan.InsuranceCorp = entOldPreLoan.InsuranceCorp;
            entPreLoan.InsuranceFee = entOldPreLoan.InsuranceFee;
            entPreLoan.AgencyFee = entOldPreLoan.AgencyFee;
            entPreLoan.ReceiveBank = entOldPreLoan.ReceiveBank;
            entPreLoan.OutVouchFee = entOldPreLoan.OutVouchFee;
            entPreLoan.VouchFee = entOldPreLoan.VouchFee;
            entPreLoan.LoanXf = entOldPreLoan.LoanXf;
            entPreLoan.LoanXfYear = entOldPreLoan.LoanXfYear;
            entPreLoan.LoanSx = entOldPreLoan.LoanSx;
            entPreLoan.LoanSxYear = entOldPreLoan.LoanSxYear;
            entPreLoan.LoanZy = entOldPreLoan.LoanZy;
            entPreLoan.LoanZyYear = entOldPreLoan.LoanZyYear;
            entPreLoan.BankQueryFee = entOldPreLoan.BankQueryFee;
            entPreLoan.BankManageFee = entOldPreLoan.BankManageFee;
            entPreLoan.Remark = entOldPreLoan.Remark;
            entPreLoan.SLRemark = entOldPreLoan.SLRemark;
            entPreLoan.FKRemark = entOldPreLoan.FKRemark;
            entPreLoan.LoanBankSaleComplete = entOldPreLoan.LoanBankSaleComplete;
            entPreLoan.LoanContractDate = entOldPreLoan.LoanContractDate;
            entPreLoan.MortgageClearDate = entOldPreLoan.MortgageClearDate;
            entPreLoan.LoanComplete = entOldPreLoan.LoanComplete;
            entPreLoan.SendToBankDate = entOldPreLoan.SendToBankDate;
            entPreLoan.VoucherToBankDate = entOldPreLoan.VoucherToBankDate;
            entPreLoan.CertificateDate = entOldPreLoan.CertificateDate;
            entPreLoan.BankCompleteDate = entOldPreLoan.BankCompleteDate;
            entPreLoan.FKDate = entOldPreLoan.FKDate;
            entPreLoan.SLDate = entOldPreLoan.SLDate;
            entPreLoan.VouchFeeDate = entOldPreLoan.VouchFeeDate;
            entPreLoan.InsuranceFeeDate = entOldPreLoan.InsuranceFeeDate;
            entPreLoan.AgencyFeeDate = entOldPreLoan.AgencyFeeDate;
            entPreLoan.OutVouchFeeDate = entOldPreLoan.OutVouchFeeDate;
            entPreLoan.EndDate = entOldPreLoan.EndDate;
            entPreLoan.CompleteLoanDate = entOldPreLoan.CompleteLoanDate;
            entPreLoan.IsNoEvaluateFee = entOldPreLoan.IsNoEvaluateFee;
            entPreLoan.IdBankReceipt = entOldPreLoan.IdBankReceipt;
            entPreLoan.IdZhuanBen = entOldPreLoan.IdZhuanBen;
            entPreLoan.IsNoAgencyFee = entOldPreLoan.IsNoAgencyFee;
            entPreLoan.IdShouBen = entOldPreLoan.IdShouBen;
            entPreLoan.IsLack = entOldPreLoan.IsLack;
            entPreLoan.EstimatePrice = entOldPreLoan.EstimatePrice;
            entPreLoan.BuildingArea = entOldPreLoan.BuildingArea;
            entPreLoan.CompleteYear = entOldPreLoan.CompleteYear;
            entPreLoan.Total_Floor = entOldPreLoan.Total_Floor;
            entPreLoan.CustomerName = entOldPreLoan.CustomerName;
            entPreLoan.IDNum = entOldPreLoan.IDNum;
            entPreLoan.GJJmoney = entOldPreLoan.GJJmoney;
            entPreLoan.GJJyear = entOldPreLoan.GJJyear;
            entPreLoan.SYMoney = entOldPreLoan.SYMoney;
            entPreLoan.SYYear = entOldPreLoan.SYYear;
            entPreLoan.OrderPlace = entOldPreLoan.OrderPlace;
            entPreLoan.Receipt = entOldPreLoan.Receipt;
            entPreLoan.Mortgage = entOldPreLoan.Mortgage;
            entPreLoan.SaleName = entOldPreLoan.SaleName;
            entPreLoan.SaleIDCard = entOldPreLoan.SaleIDCard;
            entPreLoan.ContractId = entOldPreLoan.ContractId;
            entPreLoan.ContractCode = entOldPreLoan.ContractCode;
            entPreLoan.SalePrice_T = entOldPreLoan.SalePrice_T;
            entPreLoan.SalerPhone = entOldPreLoan.SalerPhone;
            entPreLoan.BuyerPhone = entOldPreLoan.BuyerPhone;
            entPreLoan.EvaluateFeeDate = entOldPreLoan.EvaluateFeeDate;
            entPreLoan.OldLoanBank = entOldPreLoan.OldLoanBank;
            entPreLoan.OldLoanMoney = entOldPreLoan.OldLoanMoney;
            entPreLoan.OldRestMoney = entOldPreLoan.OldRestMoney;
            entPreLoan.EmpCityId = entOldPreLoan.EmpCityId;
            entPreLoan.EmpCityName = entOldPreLoan.EmpCityName;
            entPreLoan.EmpCompanyId = entOldPreLoan.EmpCompanyId;
            entPreLoan.EmpCompanyName = entOldPreLoan.EmpCompanyName;
            entPreLoan.EmpDepartId = entOldPreLoan.EmpDepartId;
            entPreLoan.EmpDepartName = entOldPreLoan.EmpDepartName;
            entPreLoan.EmployeeId = entOldPreLoan.EmployeeId;
            entPreLoan.EmployeeName = entOldPreLoan.EmployeeName;
            entPreLoan.EmpPhone = entOldPreLoan.EmpPhone;
            entPreLoan.UpSLDate = entOldPreLoan.UpSLDate;
            entPreLoan.UpSHDate = entOldPreLoan.UpSHDate;
            entPreLoan.UpFKDate = entOldPreLoan.UpFKDate;
            entPreLoan.SHDate = DateTime.Now;
            entPreLoan.Status = 30;
        }
        //修改审核人信息
        else if (status.Equals("修改审核"))
        {
            entPreLoan.RecordId = entOldPreLoan.RecordId;
            entPreLoan.MainId = entOldPreLoan.MainId;
            entPreLoan.LoanCode = entOldPreLoan.LoanCode;
            entPreLoan.LoanInfo = entOldPreLoan.LoanInfo;
            entPreLoan.LoanDealMode = entOldPreLoan.LoanDealMode;
            entPreLoan.Address = entOldPreLoan.Address;
            entPreLoan.LackInfo = entOldPreLoan.LackInfo;
            entPreLoan.EvaluateCorp = entOldPreLoan.EvaluateCorp;
            entPreLoan.EvaluateFee = entOldPreLoan.EvaluateFee;
            entPreLoan.InsuranceCorp = entOldPreLoan.InsuranceCorp;
            entPreLoan.InsuranceFee = entOldPreLoan.InsuranceFee;
            entPreLoan.AgencyFee = entOldPreLoan.AgencyFee;
            entPreLoan.ReceiveBank = entOldPreLoan.ReceiveBank;
            entPreLoan.OutVouchFee = entOldPreLoan.OutVouchFee;
            entPreLoan.VouchFee = entOldPreLoan.VouchFee;
            entPreLoan.LoanXf = entOldPreLoan.LoanXf;
            entPreLoan.LoanXfYear = entOldPreLoan.LoanXfYear;
            entPreLoan.LoanSx = entOldPreLoan.LoanSx;
            entPreLoan.LoanSxYear = entOldPreLoan.LoanSxYear;
            entPreLoan.LoanZy = entOldPreLoan.LoanZy;
            entPreLoan.LoanZyYear = entOldPreLoan.LoanZyYear;
            entPreLoan.BankQueryFee = entOldPreLoan.BankQueryFee;
            entPreLoan.BankManageFee = entOldPreLoan.BankManageFee;
            entPreLoan.Remark = entOldPreLoan.Remark;
            entPreLoan.SLRemark = entOldPreLoan.SLRemark;
            entPreLoan.FKRemark = entOldPreLoan.FKRemark;
            entPreLoan.LoanBankSaleComplete = entOldPreLoan.LoanBankSaleComplete;
            entPreLoan.LoanContractDate = entOldPreLoan.LoanContractDate;
            entPreLoan.MortgageClearDate = entOldPreLoan.MortgageClearDate;
            entPreLoan.LoanComplete = entOldPreLoan.LoanComplete;
            entPreLoan.SendToBankDate = entOldPreLoan.SendToBankDate;
            entPreLoan.VoucherToBankDate = entOldPreLoan.VoucherToBankDate;
            entPreLoan.CertificateDate = entOldPreLoan.CertificateDate;
            entPreLoan.BankCompleteDate = entOldPreLoan.BankCompleteDate;
            entPreLoan.FKDate = entOldPreLoan.FKDate;
            entPreLoan.SLDate = entOldPreLoan.SLDate;
            entPreLoan.SHDate = entOldPreLoan.SHDate;
            entPreLoan.VouchFeeDate = entOldPreLoan.VouchFeeDate;
            entPreLoan.InsuranceFeeDate = entOldPreLoan.InsuranceFeeDate;
            entPreLoan.AgencyFeeDate = entOldPreLoan.AgencyFeeDate;
            entPreLoan.OutVouchFeeDate = entOldPreLoan.OutVouchFeeDate;
            entPreLoan.EndDate = entOldPreLoan.EndDate;
            entPreLoan.CompleteLoanDate = entOldPreLoan.CompleteLoanDate;
            entPreLoan.IsNoEvaluateFee = entOldPreLoan.IsNoEvaluateFee;
            entPreLoan.IdBankReceipt = entOldPreLoan.IdBankReceipt;
            entPreLoan.IdZhuanBen = entOldPreLoan.IdZhuanBen;
            entPreLoan.IsNoAgencyFee = entOldPreLoan.IsNoAgencyFee;
            entPreLoan.IdShouBen = entOldPreLoan.IdShouBen;
            entPreLoan.IsLack = entOldPreLoan.IsLack;
            entPreLoan.UpSLDate = entOldPreLoan.UpSLDate;
            entPreLoan.UpFKDate = entOldPreLoan.UpFKDate;
            entPreLoan.EstimatePrice = entOldPreLoan.EstimatePrice;
            entPreLoan.BuildingArea = entOldPreLoan.BuildingArea;
            entPreLoan.CompleteYear = entOldPreLoan.CompleteYear;
            entPreLoan.Total_Floor = entOldPreLoan.Total_Floor;
            entPreLoan.CustomerName = entOldPreLoan.CustomerName;
            entPreLoan.IDNum = entOldPreLoan.IDNum;
            entPreLoan.GJJmoney = entOldPreLoan.GJJmoney;
            entPreLoan.GJJyear = entOldPreLoan.GJJyear;
            entPreLoan.SYMoney = entOldPreLoan.SYMoney;
            entPreLoan.SYYear = entOldPreLoan.SYYear;
            entPreLoan.OrderPlace = entOldPreLoan.OrderPlace;
            entPreLoan.Receipt = entOldPreLoan.Receipt;
            entPreLoan.Mortgage = entOldPreLoan.Mortgage;
            entPreLoan.SaleName = entOldPreLoan.SaleName;
            entPreLoan.SaleIDCard = entOldPreLoan.SaleIDCard;
            entPreLoan.ContractId = entOldPreLoan.ContractId;
            entPreLoan.ContractCode = entOldPreLoan.ContractCode;
            entPreLoan.SalePrice_T = entOldPreLoan.SalePrice_T;
            entPreLoan.SalerPhone = entOldPreLoan.SalerPhone;
            entPreLoan.BuyerPhone = entOldPreLoan.BuyerPhone;
            entPreLoan.EvaluateFeeDate = entOldPreLoan.EvaluateFeeDate;
            entPreLoan.OldLoanBank = entOldPreLoan.OldLoanBank;
            entPreLoan.OldLoanMoney = entOldPreLoan.OldLoanMoney;
            entPreLoan.OldRestMoney = entOldPreLoan.OldRestMoney;
            entPreLoan.EmpCityId = entOldPreLoan.EmpCityId;
            entPreLoan.EmpCityName = entOldPreLoan.EmpCityName;
            entPreLoan.EmpCompanyId = entOldPreLoan.EmpCompanyId;
            entPreLoan.EmpCompanyName = entOldPreLoan.EmpCompanyName;
            entPreLoan.EmpDepartId = entOldPreLoan.EmpDepartId;
            entPreLoan.EmpDepartName = entOldPreLoan.EmpDepartName;
            entPreLoan.EmployeeId = entOldPreLoan.EmployeeId;
            entPreLoan.EmployeeName = entOldPreLoan.EmployeeName;
            entPreLoan.EmpPhone = entOldPreLoan.EmpPhone;
            entPreLoan.UpSHDate = DateTime.Now;
            entPreLoan.Status = 40;
        }
        //添加放款人信息
        else if (status.Equals("添加放款"))
        {
            entPreLoan.RecordId = entOldPreLoan.RecordId;
            entPreLoan.MainId = entOldPreLoan.MainId;
            entPreLoan.LoanCode = entOldPreLoan.LoanCode;
            entPreLoan.LoanInfo = entOldPreLoan.LoanInfo;
            entPreLoan.LoanDealMode = entOldPreLoan.LoanDealMode;
            entPreLoan.Address = entOldPreLoan.Address;
            entPreLoan.LackInfo = entOldPreLoan.LackInfo;
            entPreLoan.EvaluateCorp = entOldPreLoan.EvaluateCorp;
            entPreLoan.EvaluateFee = entOldPreLoan.EvaluateFee;
            entPreLoan.InsuranceCorp = entOldPreLoan.InsuranceCorp;
            entPreLoan.InsuranceFee = entOldPreLoan.InsuranceFee;
            entPreLoan.AgencyFee = entOldPreLoan.AgencyFee;
            entPreLoan.ReceiveBank = entOldPreLoan.ReceiveBank;
            entPreLoan.OutVouchFee = entOldPreLoan.OutVouchFee;
            entPreLoan.VouchFee = entOldPreLoan.VouchFee;
            entPreLoan.LoanXf = entOldPreLoan.LoanXf;
            entPreLoan.LoanXfYear = entOldPreLoan.LoanXfYear;
            entPreLoan.LoanSx = entOldPreLoan.LoanSx;
            entPreLoan.LoanSxYear = entOldPreLoan.LoanSxYear;
            entPreLoan.LoanZy = entOldPreLoan.LoanZy;
            entPreLoan.LoanZyYear = entOldPreLoan.LoanZyYear;
            entPreLoan.BankQueryFee = entOldPreLoan.BankQueryFee;
            entPreLoan.BankManageFee = entOldPreLoan.BankManageFee;
            entPreLoan.Remark = entOldPreLoan.Remark;
            entPreLoan.SLRemark = entOldPreLoan.SLRemark;
            entPreLoan.SHRemark = entOldPreLoan.SHRemark;
            entPreLoan.BankLoanDate = entOldPreLoan.BankLoanDate;
            entPreLoan.ReceiveLoanDate = entOldPreLoan.ReceiveLoanDate;
            entPreLoan.LoanBankSaleComplete = entOldPreLoan.LoanBankSaleComplete;
            entPreLoan.LoanContractDate = entOldPreLoan.LoanContractDate;
            entPreLoan.MortgageClearDate = entOldPreLoan.MortgageClearDate;
            entPreLoan.LoanComplete = entOldPreLoan.LoanComplete;
            entPreLoan.SendToBankDate = entOldPreLoan.SendToBankDate;
            entPreLoan.SHDate = entOldPreLoan.SHDate;
            entPreLoan.SLDate = entOldPreLoan.SLDate;
            entPreLoan.VouchFeeDate = entOldPreLoan.VouchFeeDate;
            entPreLoan.InsuranceFeeDate = entOldPreLoan.InsuranceFeeDate;
            entPreLoan.AgencyFeeDate = entOldPreLoan.AgencyFeeDate;
            entPreLoan.OutVouchFeeDate = entOldPreLoan.OutVouchFeeDate;
            entPreLoan.EndDate = entOldPreLoan.EndDate;
            entPreLoan.EstimReportBackDate = entOldPreLoan.EstimReportBackDate;
            entPreLoan.IsNoEvaluateFee = entOldPreLoan.IsNoEvaluateFee;
            entPreLoan.IdBankReceipt = entOldPreLoan.IdBankReceipt;
            entPreLoan.IdZhuanBen = entOldPreLoan.IdZhuanBen;
            entPreLoan.IsNoAgencyFee = entOldPreLoan.IsNoAgencyFee;
            entPreLoan.IdShouBen = entOldPreLoan.IdShouBen;
            entPreLoan.IsLack = entOldPreLoan.IsLack;
            entPreLoan.UpSLDate = entOldPreLoan.UpSLDate;
            entPreLoan.UpSHDate = entOldPreLoan.UpSHDate;
            entPreLoan.UpFKDate = entOldPreLoan.UpFKDate;
            entPreLoan.EstimatePrice = entOldPreLoan.EstimatePrice;
            entPreLoan.BuildingArea = entOldPreLoan.BuildingArea;
            entPreLoan.CompleteYear = entOldPreLoan.CompleteYear;
            entPreLoan.Total_Floor = entOldPreLoan.Total_Floor;
            entPreLoan.CustomerName = entOldPreLoan.CustomerName;
            entPreLoan.IDNum = entOldPreLoan.IDNum;
            entPreLoan.GJJmoney = entOldPreLoan.GJJmoney;
            entPreLoan.GJJyear = entOldPreLoan.GJJyear;
            entPreLoan.SYMoney = entOldPreLoan.SYMoney;
            entPreLoan.SYYear = entOldPreLoan.SYYear;
            entPreLoan.OrderPlace = entOldPreLoan.OrderPlace;
            entPreLoan.Receipt = entOldPreLoan.Receipt;
            entPreLoan.Mortgage = entOldPreLoan.Mortgage;
            entPreLoan.SaleName = entOldPreLoan.SaleName;
            entPreLoan.SaleIDCard = entOldPreLoan.SaleIDCard;
            entPreLoan.ContractId = entOldPreLoan.ContractId;
            entPreLoan.ContractCode = entOldPreLoan.ContractCode;
            entPreLoan.SalePrice_T = entOldPreLoan.SalePrice_T;
            entPreLoan.SalerPhone = entOldPreLoan.SalerPhone;
            entPreLoan.BuyerPhone = entOldPreLoan.BuyerPhone;
            entPreLoan.EvaluateFeeDate = entOldPreLoan.EvaluateFeeDate;
            entPreLoan.OldLoanBank = entOldPreLoan.OldLoanBank;
            entPreLoan.OldLoanMoney = entOldPreLoan.OldLoanMoney;
            entPreLoan.OldRestMoney = entOldPreLoan.OldRestMoney;
            entPreLoan.EmpCityId = entOldPreLoan.EmpCityId;
            entPreLoan.EmpCityName = entOldPreLoan.EmpCityName;
            entPreLoan.EmpCompanyId = entOldPreLoan.EmpCompanyId;
            entPreLoan.EmpCompanyName = entOldPreLoan.EmpCompanyName;
            entPreLoan.EmpDepartId = entOldPreLoan.EmpDepartId;
            entPreLoan.EmpDepartName = entOldPreLoan.EmpDepartName;
            entPreLoan.EmployeeId = entOldPreLoan.EmployeeId;
            entPreLoan.EmployeeName = entOldPreLoan.EmployeeName;
            entPreLoan.EmpPhone = entOldPreLoan.EmpPhone;
            entPreLoan.FKDate = DateTime.Now;
            entPreLoan.Status = 50;
        }
        //修改放款人信息
        else if (status.Equals("修改放款"))
        {
            entPreLoan.RecordId = entOldPreLoan.RecordId;
            entPreLoan.MainId = entOldPreLoan.MainId;
            entPreLoan.LoanCode = entOldPreLoan.LoanCode;
            entPreLoan.LoanInfo = entOldPreLoan.LoanInfo;
            entPreLoan.LoanDealMode = entOldPreLoan.LoanDealMode;
            entPreLoan.Address = entOldPreLoan.Address;
            entPreLoan.LackInfo = entOldPreLoan.LackInfo;
            entPreLoan.EvaluateCorp = entOldPreLoan.EvaluateCorp;
            entPreLoan.EvaluateFee = entOldPreLoan.EvaluateFee;
            entPreLoan.InsuranceCorp = entOldPreLoan.InsuranceCorp;
            entPreLoan.InsuranceFee = entOldPreLoan.InsuranceFee;
            entPreLoan.AgencyFee = entOldPreLoan.AgencyFee;
            entPreLoan.ReceiveBank = entOldPreLoan.ReceiveBank;
            entPreLoan.OutVouchFee = entOldPreLoan.OutVouchFee;
            entPreLoan.VouchFee = entOldPreLoan.VouchFee;
            entPreLoan.LoanXf = entOldPreLoan.LoanXf;
            entPreLoan.LoanXfYear = entOldPreLoan.LoanXfYear;
            entPreLoan.LoanSx = entOldPreLoan.LoanSx;
            entPreLoan.LoanSxYear = entOldPreLoan.LoanSxYear;
            entPreLoan.LoanZy = entOldPreLoan.LoanZy;
            entPreLoan.LoanZyYear = entOldPreLoan.LoanZyYear;
            entPreLoan.BankQueryFee = entOldPreLoan.BankQueryFee;
            entPreLoan.BankManageFee = entOldPreLoan.BankManageFee;
            entPreLoan.Remark = entOldPreLoan.Remark;
            entPreLoan.SLRemark = entOldPreLoan.SLRemark;
            entPreLoan.SHRemark = entOldPreLoan.SHRemark;
            entPreLoan.BankLoanDate = entOldPreLoan.BankLoanDate;
            entPreLoan.ReceiveLoanDate = entOldPreLoan.ReceiveLoanDate;
            entPreLoan.LoanBankSaleComplete = entOldPreLoan.LoanBankSaleComplete;
            entPreLoan.LoanContractDate = entOldPreLoan.LoanContractDate;
            entPreLoan.MortgageClearDate = entOldPreLoan.MortgageClearDate;
            entPreLoan.LoanComplete = entOldPreLoan.LoanComplete;
            entPreLoan.SendToBankDate = entOldPreLoan.SendToBankDate;
            entPreLoan.FKDate = entOldPreLoan.FKDate;
            entPreLoan.SLDate = entOldPreLoan.SLDate;
            entPreLoan.SHDate = entOldPreLoan.SHDate;
            entPreLoan.VouchFeeDate = entOldPreLoan.VouchFeeDate;
            entPreLoan.InsuranceFeeDate = entOldPreLoan.InsuranceFeeDate;
            entPreLoan.AgencyFeeDate = entOldPreLoan.AgencyFeeDate;
            entPreLoan.OutVouchFeeDate = entOldPreLoan.OutVouchFeeDate;
            entPreLoan.EndDate = entOldPreLoan.EndDate;
            entPreLoan.EstimReportBackDate = entOldPreLoan.EstimReportBackDate;
            entPreLoan.IsNoEvaluateFee = entOldPreLoan.IsNoEvaluateFee;
            entPreLoan.IdBankReceipt = entOldPreLoan.IdBankReceipt;
            entPreLoan.IdZhuanBen = entOldPreLoan.IdZhuanBen;
            entPreLoan.IsNoAgencyFee = entOldPreLoan.IsNoAgencyFee;
            entPreLoan.IdShouBen = entOldPreLoan.IdShouBen;
            entPreLoan.IsLack = entOldPreLoan.IsLack;
            entPreLoan.UpSLDate = entOldPreLoan.UpSLDate;
            entPreLoan.UpSHDate = entOldPreLoan.UpSHDate;
            entPreLoan.EstimatePrice = entOldPreLoan.EstimatePrice;
            entPreLoan.BuildingArea = entOldPreLoan.BuildingArea;
            entPreLoan.CompleteYear = entOldPreLoan.CompleteYear;
            entPreLoan.Total_Floor = entOldPreLoan.Total_Floor;
            entPreLoan.CustomerName = entOldPreLoan.CustomerName;
            entPreLoan.IDNum = entOldPreLoan.IDNum;
            entPreLoan.GJJmoney = entOldPreLoan.GJJmoney;
            entPreLoan.GJJyear = entOldPreLoan.GJJyear;
            entPreLoan.SYMoney = entOldPreLoan.SYMoney;
            entPreLoan.SYYear = entOldPreLoan.SYYear;
            entPreLoan.OrderPlace = entOldPreLoan.OrderPlace;
            entPreLoan.Receipt = entOldPreLoan.Receipt;
            entPreLoan.Mortgage = entOldPreLoan.Mortgage;
            entPreLoan.SaleName = entOldPreLoan.SaleName;
            entPreLoan.SaleIDCard = entOldPreLoan.SaleIDCard;
            entPreLoan.ContractId = entOldPreLoan.ContractId;
            entPreLoan.ContractCode = entOldPreLoan.ContractCode;
            entPreLoan.SalePrice_T = entOldPreLoan.SalePrice_T;
            entPreLoan.SalerPhone = entOldPreLoan.SalerPhone;
            entPreLoan.BuyerPhone = entOldPreLoan.BuyerPhone;
            entPreLoan.EvaluateFeeDate = entOldPreLoan.EvaluateFeeDate;
            entPreLoan.OldLoanBank = entOldPreLoan.OldLoanBank;
            entPreLoan.OldLoanMoney = entOldPreLoan.OldLoanMoney;
            entPreLoan.OldRestMoney = entOldPreLoan.OldRestMoney;
            entPreLoan.EmpCityId = entOldPreLoan.EmpCityId;
            entPreLoan.EmpCityName = entOldPreLoan.EmpCityName;
            entPreLoan.EmpCompanyId = entOldPreLoan.EmpCompanyId;
            entPreLoan.EmpCompanyName = entOldPreLoan.EmpCompanyName;
            entPreLoan.EmpDepartId = entOldPreLoan.EmpDepartId;
            entPreLoan.EmpDepartName = entOldPreLoan.EmpDepartName;
            entPreLoan.EmployeeId = entOldPreLoan.EmployeeId;
            entPreLoan.EmployeeName = entOldPreLoan.EmployeeName;
            entPreLoan.EmpPhone = entOldPreLoan.EmpPhone;
            entPreLoan.UpFKDate = DateTime.Now;
            entPreLoan.Status = 60;
        }

        entPreLoan.OperateCompanyId = CurrentUserInfo.CompanyId;
        entPreLoan.OperateCompanyName = CurrentUserInfo.CompanyName;
        entPreLoan.OperateDepartId = CurrentUserInfo.DepartId;
        entPreLoan.OperateDepartName = CurrentUserInfo.DepartName;
        entPreLoan.OperateUserId = CurrentUserInfo.UserId;
        entPreLoan.OperateUserName = CurrentUserInfo.UserName;

        return entPreLoan;
    }
}